package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.core.integration.EduAddressSchoolReplaceIntegration;
import com.jwsoft.manager.common.vo.eduAddressSchoolReplace.EduAddressSchoolReplaceVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolReplace.EduAddressSchoolReplaceKeyVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolReplace.EduAddressSchoolReplaceQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 地址学区替换表网关
 *
 * @author zhiyuan
 * @since 2024-03-18
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "地址学区替换表", description = "地址学区替换表")
public class EduAddressSchoolReplaceController {

    @Autowired
    public EduAddressSchoolReplaceIntegration eduAddressSchoolReplaceIntegration;

    @Operation(summary = "地址学区替换表分页查询",description = "地址学区替换表分页查询")
    @PostMapping(value = "/addressSchoolReplace0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolReplaceVO>> getList(@RequestBody @Validated EduAddressSchoolReplaceQueryVO vo) {
        return AppResponse.successData(eduAddressSchoolReplaceIntegration.getList(vo));
    }

    @Operation(summary = "地址学区替换表根据主键查询详情",description = "地址学区替换表根据主键查询详情")
    @PostMapping(value = "/addressSchoolReplace0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolReplaceVO> getById(@RequestBody @Validated EduAddressSchoolReplaceKeyVO vo) {
        return AppResponse.successData(eduAddressSchoolReplaceIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "地址学区替换表新增",description = "地址学区替换表新增")
    @PostMapping(value = "/addressSchoolReplace0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolReplaceVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduAddressSchoolReplaceVO vo) {
        return AppResponse.successData(eduAddressSchoolReplaceIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "地址学区替换表修改",description = "地址学区替换表修改")
    @PostMapping(value = "/addressSchoolReplace0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolReplaceVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduAddressSchoolReplaceVO vo) {
        return AppResponse.successData(eduAddressSchoolReplaceIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "地址学区替换表删除",description = "地址学区替换表删除")
    @PostMapping(value = "/addressSchoolReplace0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduAddressSchoolReplaceKeyVO vo) {
        eduAddressSchoolReplaceIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "地址学区替换",description = "地址学区替换")
    @PostMapping(value = "/addressSchoolReplace0007", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduAddressSchoolReplaceVO> addressSchoolReplace(@RequestBody @Validated(value = {Validators.Add.class}) EduAddressSchoolReplaceVO vo) {
        eduAddressSchoolReplaceIntegration.addressSchoolReplace(vo);
        return AppResponse.successMsg("处理成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "替换信息补全",description = "替换信息补全")
    @PostMapping(value = "/addressSchoolReplace0008", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduAddressSchoolReplaceVO> replaceInfoComplement(@RequestBody @Validated(value = {Validators.Add.class}) EduAddressSchoolReplaceVO vo) {
        eduAddressSchoolReplaceIntegration.addressInfoComplement(vo);
        return AppResponse.successMsg("处理成功！");
    }
}
